package ${basepackage}.framework.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import ${basepackage}.framework.base.controller.BaseSpringController;
import ${basepackage}.framework.base.page.Page;
import ${basepackage}.framework.query.AuditLogQuery;
import ${basepackage}.framework.service.AuditLogService;
import ${basepackage}.framework.vo.ValueObject;

@Controller
@RequestMapping(value="auditlog")
public class AuditLogController extends BaseSpringController {

	protected static final String DEFAULT_SORT_COLUMNS = null; 
	
	@Autowired
	private AuditLogService auditLogService;
	
	private final String LIST_ACTION = "redirect:/auditlog/list";
	
	@RequestMapping(value="/list")
	public ModelAndView list(AuditLogQuery query){
		System.out.println("query = " + query);
		Page page = auditLogService.findPage(query);
		
		ModelAndView result = new ModelAndView("/auditlog/list");
		result.addAllObjects(toModelMap(page, query));
		return result;
		
	}
	
	/** 
	 * 查看对象
	 **/
	@RequestMapping(value="/show")
	public ModelAndView show(HttpServletRequest request) throws Exception {
		java.lang.Long id = new java.lang.Long(request.getParameter("id"));
		List<ValueObject> list = auditLogService.getAuditLogDetail(id);
		ModelMap modelMap = new ModelMap();
		modelMap.addAttribute("auditLogList",list);
		return new ModelAndView("/auditlog/show",modelMap);
	}
}
